﻿using System;
using System.Linq;
using cz.zcu.PreSti;

namespace PreStiParallelPortLibraryTester
{
    class Program
    {
        static void Main(string[] args)
        {
            byte data = 0;
            byte port = 1;
            int status;
            try
            {
                if (args.Count() >= 1) data = Byte.Parse(args[0]);
                if (args.Count() >= 2) port = Byte.Parse(args[1]);
            }
            catch { }
            status = ParallelPortLibrary.write(data, port);
            switch (status)
            {
                case 0: Console.WriteLine("Data sent successfully."); break;
                case -1: Console.WriteLine("LPT%d port is not present", port); break;
                case -2: Console.WriteLine("PreSti Parallel Port Driver is not insalled!"); break;
                case -3: Console.WriteLine("Cannot write to parallel port!"); break;
            }
        }
    }
}
